﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.ViewModels
{
    public class CodeMetricsCalculationResultGridViewModel : CodeAnalysisResultGridViewModelBase
    {
        protected override string SettingPath
        {
            get
            {
                return Path.Combine(Core.Constants.AppDataDir, "CodeMetricsCalculationResultDataGridColumnSetting.xml");
            }
        }

        protected override IEnumerable<DataGridColumnViewModel> DataGridColumnViewModels
        {
            get
            {
                yield return Kind;
                yield return Name;
                yield return MaintainabilityIndex;
                yield return CyclomaticComplexity;
                yield return ClassCoupling;
                yield return LinesOfCode;
                yield return DepthOfInheritance;
            }
        }

        public DataGridColumnViewModel Kind { get; private set; }

        public DataGridColumnViewModel Name { get; private set; }

        public DataGridColumnViewModel MaintainabilityIndex { get; private set; }

        public DataGridColumnViewModel CyclomaticComplexity { get; private set; }

        public DataGridColumnViewModel ClassCoupling { get; private set; }

        public DataGridColumnViewModel LinesOfCode { get; private set; }

        public DataGridColumnViewModel DepthOfInheritance { get; private set; }


        public CodeMetricsCalculationResultGridViewModel()
        {
            Kind = new DataGridColumnViewModel("Kind");
            Name = new DataGridColumnViewModel("Name");
            MaintainabilityIndex = new DataGridColumnViewModel("MaintainabilityIndex");
            CyclomaticComplexity = new DataGridColumnViewModel("CyclomaticComplexity");
            ClassCoupling = new DataGridColumnViewModel("ClassCoupling");
            LinesOfCode = new DataGridColumnViewModel("LinesOfCode");
            DepthOfInheritance = new DataGridColumnViewModel("DepthOfInheritance");

            Reset();
        }


        public override void Reset()
        {
            Kind.DisplayIndex = 0;
            Kind.IsVisible = true;
            Kind.Width = 25;
            Name.DisplayIndex = 1;
            Name.IsVisible = true;
            Name.Width = 300;
            MaintainabilityIndex.DisplayIndex = 2;
            MaintainabilityIndex.IsVisible = true;
            MaintainabilityIndex.Width = 50;
            CyclomaticComplexity.DisplayIndex = 3;
            CyclomaticComplexity.IsVisible = true;
            CyclomaticComplexity.Width =50;
            ClassCoupling.DisplayIndex = 4;
            ClassCoupling.IsVisible = true;
            ClassCoupling.Width = 50;
            LinesOfCode.DisplayIndex = 5;
            LinesOfCode.IsVisible = true;
            LinesOfCode.Width = 50;
            DepthOfInheritance.DisplayIndex = 6;
            DepthOfInheritance.IsVisible = true;
            DepthOfInheritance.Width = 50;
        }
    }
}
